package topo.autosearch;

import com.zhtelecom.nms.framework.discover.DeviceTypeInfo;
import com.zhtelecom.nms.framework.discover.DiscoverConfig;
import java.util.List;
import java.util.Vector;
import topo.data.NodeType;

public class InitDeviceTypeConfig {
    public static void init() throws Exception {
        try {
            List nodeTypeList = NodeType.getNodeTypeList();
            DiscoverConfig.clearAllDeviceType();
            for (NodeType dbNodeType : nodeTypeList) {
                DeviceTypeInfo discoverDiviceType = new DeviceTypeInfo();
                discoverDiviceType.setDeviceProductType(dbNodeType.getNodeType());
                discoverDiviceType.setLogicType(dbNodeType.getNodeType());

                List descList = new Vector();
                descList.add(dbNodeType.getTypeDescCharacter());
                discoverDiviceType.setTypeDescCharacter(descList);

                List oidList = new Vector();
                oidList.add(dbNodeType.getTypeOIDCharacter());
                discoverDiviceType.setTypeOIDCharacter(oidList);

                DiscoverConfig.addDeviceType(discoverDiviceType);
            }
        } catch (Exception ex) {
            throw new Exception(ex);
        }
    }
}